<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="ss"%>

<jsp:include page="../header.jsp" />
<script type="text/javascript">
function createUrl(url){
	openDialog("../"+url+"&authorId="+${author.id});
}
</script>
<div id="content">
	<div id="topstory" class="box">
		<h1>
			<fmt:message key="author.title.show" />
		</h1>
	</div>
	<div class="padding">
		<c:choose>
			<c:when test="${ author != null}">
				<table border="0" cellspacing="5" cellpadding="0" width="100%" class="formTable tplBorder">
					<tr>
						<td width="15%"></td>
						<td width="35%"></td>
						<td width="15%"></td>
						<td width="35%"></td>
					</tr>
					<tr>
						<td class="label"><fmt:message key="author.name" /></td>
						<td class="valueOutView"><c:out value="${author.jmeno }" /></td>
						<td colspan="2" />
					</tr>
					<tr>
						<td class="label"><fmt:message key="author.surname" /></td>
						<td class="valueOutView"><c:out value="${author.prijmeni }" /></td>
						<td colspan="2" />
					</tr>
				</table>	
						<display:table export="true" id="data" name="knihaList" requestURI="/authors/show.do?authorId=${author.id}"
							decorator="cz.boxdesign.library.web.decorator.BookTableDecorator">
							<ss:authorize access="hasRole('ROLE_ADMIN')">
								<display:column property="editUrl" titleKey="common.edit" sortable="false" />
								<display:column property="deleteFromAuthorUrl" titleKey="common.delete" sortable="false" />
							</ss:authorize>
							<display:column property="showUrl" titleKey="common.show" sortable="false" />
							<display:column property="nazev" titleKey="book.list.name" sortable="true" />
							<display:column property="oddeleniLink" titleKey="book.list.departent" sortable="true" />
							<display:column property="nakladatelstviLink" titleKey="book.list.publisher" sortable="true" />
							<display:column property="pocetKnih" titleKey="book.list.book.count" sortable="true" />
							<display:column property="rokVydani" titleKey="book.list.year" sortable="true" />
						</display:table>
				
			</c:when>
			<c:otherwise>
				<div class="ui-widget">
					<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
						<p>
							<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong>Alert:</strong>
							<c:out value="${error }" />
							. Please contact administrator.
						</p>
					</div>
				</div>

			</c:otherwise>
		</c:choose>
	</div>
	<!-- /padding -->
</div>
<!-- /content -->
<jsp:include page="side-menu.jsp" />
<jsp:include page="../foother.jsp" />
